@extends('layouts.mobile_main')

@section('title', '城市')

@section('resources')
    @parent
    <link rel="stylesheet" href="{{ env('CSS_DOMAIN') }}/css/public.css?v={{env('CSS_VERSION')}}">
    <link rel="stylesheet" href="{{env('CSS_DOMAIN')}}/css/kalendae.css?v={{env('CSS_VERSION')}}" type="text/css">
    <link rel="stylesheet" href="{{env('CSS_DOMAIN')}}/css/lanren.css?v={{env('CSS_VERSION')}}">
    <script src="{{ env('JS_DOMAIN') }}/js/adaptation.js?v={{env('JS_VERSION')}}"></script>
@endsection
<style>
	.local_city{height: 0.6rem;line-height: 0.6rem;padding-left: 0.6rem;background-color: #ece6f2;}
	.local_citys{height: 1.2rem;padding-top: 0.2rem;padding-left: 0.6rem;border-bottom: 0.2rem solid #ece6f2;}
	.local_citys a{border: 1px solid #9955c6;padding: 0.15rem 0.45rem;border-radius: 0.2rem;margin: 0 0.2rem;}
</style>
@section('content')
<!-- 代码部分begin -->
<header class="pay_sure oh" style="background-color: #9955c6;">
	<a class="fl" href="javascript:history.go(-1);">
	<img class="fl" src="{{env('IMAGE_DOMAIN')}}images/back_w.png?v={{env('IMAGE_VERSION')}}" alt=""></a>
	<span class="fl co_white fz_48">选择城市</span>
</header>
<p class="fz_34 co_gray local_city">当前定位城市</p>
<p class="fz_44 local_citys">
	<a href="/mobile/index?cityid={{$cityid}}&cityname={{$cityname}}" class="fl">{{$cityname}}</a>
</p>
<!-- <p class="fz_34 co_gray local_city">最近浏览城市</p>
<p class="fz_44 local_citys oh">
    @foreach($mycitylists as $list)
	    <a href="/mobile/city/switch?cityid={{$list['cityid']}}&cityname={{$list['cityname']}}" class="fl">{{$list['cityname']}}</a>
	@endforeach
</p> -->
<p class="fz_34" style="height: 0.8rem;line-height: 0.8rem;padding-left: 0.6rem;">已开通城市</p>
<div id="letter" >
-->

</div>
<ul class="sort_box">
    @foreach($citylists as $list)
        <li class="sort_list">
          <a href="/mobile/city/switch?cityid={{$list['id']}}&cityname={{$list['name']}}" onclick="confirm("确定要切换?"); return;">
            <p class="num_name">{{$list['name']}}</p>
          </a>
        </li>
    @endforeach
</ul>
<div class="initials">
	<ul>
		<li style="padding: 0;"><img src="{{env('IMAGE_DOMAIN')}}images/068.png"></li>
	</ul>
</div>
<div id='container' style="width: 0;height: 0;"></div>
@endsection

@section("scriptResources")
    @parent
    <script src="{{ env('JS_DOMAIN') }}/js/banner.js?v={{env('JS_VERSION')}}"></script>
    <script src="{{ env('JS_DOMAIN') }}/js/include.js?v={{env('JS_VERSION')}}"></script>
    <script src="{{env('JS_DOMAIN')}}/js/jquery.charfirst.pinyin.js?v={{env('JS_VERSION')}}"></script>
    <script src="{{env('JS_DOMAIN')}}/js/sort.js?v={{env('JS_VERSION')}}"></script>
    <script type="text/javascript" src="http://webapi.amap.com/maps?v=1.3&key=a9fe1b184bacd00ecd70365903024419"></script>
    <script type="text/javascript" src="http://cache.amap.com/lbs/static/addToolbar.js"></script>
    <script>
        var map, geolocation;
        //加载地图，调用浏览器定位服务
        map = new AMap.Map('container', {
            resizeEnable: true
        });
        map.plugin('AMap.Geolocation', function() {
            geolocation = new AMap.Geolocation({
                 enableHighAccuracy: true,//是否使用高精度定位，默认:true
                timeout: 10000,          //超过10秒后停止定位，默认：无穷大
                maximumAge: 0,           //定位结果缓存0毫秒，默认：0
                convert: true,           //自动偏移坐标，偏移后的坐标为高德坐标，默认：true
                showButton: true,        //显示定位按钮，默认：true
                buttonPosition: 'LB',    //定位按钮停靠位置，默认：'LB'，左下角
                buttonOffset: new AMap.Pixel(10, 20),//定位按钮与设置的停靠位置的偏移量，默认：Pixel(10, 20)
                showMarker: true,        //定位成功后在定位到的位置显示点标记，默认：true
                showCircle: true,        //定位成功后用圆圈表示定位精度范围，默认：true
                panToLocation: true,     //定位成功后将定位到的位置作为地图中心点，默认：true
                zoomToAccuracy:true      //定位成功后调整地图视野范围使定位位置及精度范围视野内可见，默认：false
            });
            map.addControl(geolocation);
            geolocation.getCurrentPosition();
            AMap.event.addListener(geolocation, 'complete', onComplete);//返回定位信息
            //AMap.event.addListener(geolocation, 'error', onError);      //返回定位出错信息
        });
        function onComplete(data) {
            console.log(data.position.getLng())//经度
            console.log(data.position.getLat())//纬度
            $.ajax({
                url:"/mobile/lngandlat/get",
                data:{
                    'longitude':data.position.getLng(),
                    'latitude':data.position.getLat()
                    },
                async:false
            });
        }
        window.onresize=function(){
            pagesp();
        }

        $(function(){
            var paysu_outer_h=$(window).height();
            $(".paysu_outer").css({"min-height":paysu_outer_h});
            $(".sort_box li").click(function(){
                var i=$(this).index();
                window.location.href="/mobile/index";
            })
        })
    </script>
@endsection

